<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
                xmlns:h="http://xmlns.jcp.org/jsf/html">
    <!--
    --> 
    <p:growl id='mesages'/>
    <p:panelGrid columns="4" id="productContainer" >
        

        <p:outputLabel for="projectName" value="Product Name"/>
        <p:inputText id="projectName" value="#{productCon.productName}" />
        <p:outputLabel for="productDesc" value="Project Description"/>
        <p:inputTextarea id="productDesc" value="#{productCon.productDescription}"/>
        </p:panelGrid>
    <p:commandButton id="addFeature" value="Add Product Features"  actionListener="#{productCon.addFeature()}" update="FeaturesContainer,mesages" />
   
    <p:separator/>
    <p:panelGrid columns="2" id="FeaturesContainer" >
        <f:facet name="header">Product Features</f:facet>
        <c:forEach  items="#{productCon.featureses}" var="fet" varStatus="status">
        <p:outputLabel  value="Feature Name"/>
        <p:inputText  value="#{fet.name}" required="true"/>
          <p:outputLabel  value="Product Name"/>
          <p:selectOneMenu value="#{fet.type}" required="true">
              <f:selectItems value="#{productCon.featureTypes}" var="type" itemValue="#{type}" itemLabel="#{type}"/>
          </p:selectOneMenu>
          
        </c:forEach>

        <f:facet name="footer">

            <p:commandButton update="products" value="Save Product" action="#{productCon.saveProduct()}" icon="ui-icon-arrowreturnthick-1-w" oncomplete="PF('addProduct').hide()"/>
        </f:facet>
</p:panelGrid>

    


</ui:composition>

